<template>
	<view>
		<u-picker :itemHeight="50" :visibleItemCount="6" :show="show" :defaultIndex="defaultIndex" :keyName="keyName" :columns="columns" confirmColor="#FE5A13" @cancel="close" @confirm="pickerConfirm"></u-picker>
	</view>
</template>

<script>
	
	export default {
		name:"OnePicker",
		props:{
			columns: {
				default:[[]]
			},
			confirmIsClose:{	// 触发confirm时是否关闭picker
				default: true
			},
			keyName:{
				default: ''
			},
			defaultIndex:{
				default: [0]
			}
		},
		data() {
			return {
				show: false
			};
		},
		methods:{
			open(){
				this.show = true
			},
			close(){
				this.show = false
			},
			pickerConfirm(e){
				this.confirmIsClose && this.close()
				this.$emit('pickerConfirm', {
					index: e.indexs[0],
					value: e.value[0]
				})
			}
		}
	}
</script>

<style>

</style>